package com.yegs.admin.config;
import org.apache.shiro.authz.AuthorizationException;
import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 描述：异常拦截类
 *
 */
@ControllerAdvice
public class NoPermissionException {

    @ResponseBody
    @ExceptionHandler(UnauthorizedException.class)
    public Msg handleShiroException(Exception e) {
        e.printStackTrace();
    	return Msg.unAuth();
    }

    @ResponseBody
    @ExceptionHandler(AuthorizationException.class)
    public Msg AuthorizationException(Exception e) {
        return Msg.unAuth();
    }
}
